package regex;

public class RegexTest1 {
    public static void main(String[] args) {
        System.out.println(checkQQ("274647373"));

        System.out.println("-------------------------------------------");

        System.out.println(checkQQ1("3635252634"));
    }
    public static boolean checkQQ1(String qq){
        return qq != null && qq.matches("[1-9]\\d{5,19}");
    }


    public static boolean checkQQ(String qq){
        // 判断QQ号是否为null
        if ( qq == null || qq.startsWith("0") || qq.length() < 6 || qq.length() > 20){
            return false;
        }
        // 判断QQ号码是不是都为数字
        for (int i = 0; i < qq.length(); i++) {
            char ch = qq.charAt(i);
            if (ch < '0' || ch> '9'){
                return false;
            }
        }
        return true;
    }
}
